import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'

Vue.use(Vuex)


const modulesFiles = require.context('./modules', true, /\.js$/)

// you do not need `import app from './modules/app'`
// it will auto require all vuex module from modules file
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
  // set './app.js' => 'app'
  const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
  const value = modulesFiles(modulePath)
  modules[moduleName] = value.default
  return modules
}, {})

const store = new Vuex.Store({
  modules,
  state:{
    http:'https://wx.honghengxinxi.com',
    http4:'https://map.honghengxinxi.com:4001',
    http3:'https://interface.honghengxinxi.com',
    map:{},
    keepAlive: ['first'],
    nubula:'http://183.221.79.99:8888',
    username:'mrk_admin',
    password: 'a66abb5684c45962d887564f08346e8d',
    headurl:'https://interface.honghengxinxi.com/getImg/avatar',
    passUrl:'https://interface.honghengxinxi.com/getImg/pic'
  },
  getters
})

export default store
